    package ModelLayer;
import java.util.ArrayList;


public class PaymentTypes
{
    //instance variables
    private static PaymentTypes instance = null;
    private static ArrayList<PaymentType> paymentTypes;
    
    /**
     * Empty constructor for testing purposes
     */
    
    private PaymentTypes()
    {
       paymentTypes = new ArrayList<PaymentType>();
    }

    /**
     * Singleton static inplementation  
     */
    
    public static PaymentTypes getInstance()
    {
        if(instance == null)
      {
        instance = new PaymentTypes();
      }
      return instance;
    }
   
     /**
     * Accessor and Mutator methods
     */
    
    public static void addPaymentType(PaymentType _paymentType)
    {
        paymentTypes.add(_paymentType);
    }
    
    public static PaymentType getPaymentType(String _id)
    {
        PaymentType o = new PaymentType();
        for(int i=0; i<paymentTypes.size(); i++)  
        {
            if (paymentTypes.get(i).getId().equals(_id))
                o = paymentTypes.get(i);
        }
        return o;
    }
    
    public static void printPaymentTypes()
    {
        System.out.println("\nPayment Types:");
        for(int i = 0; i < paymentTypes.size(); i++)
        {
            System.out.println("\nId: " + paymentTypes.get(i).getId() +
                                "\nName: " + paymentTypes.get(i).getName() + "\n");
        }
    }
    
    public static int getSize()
    {
        return paymentTypes.size();
    }
}
